package day2;

import javax.sound.midi.Soundbank;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Arr2 {
    public static void main(String[] args) {
        int[] a = {-1, -2, -3, 5, -26, -361, -100, -200, -55, -10, -14};
        System.out.println(a.length);
        int[] a2 = new int[10];
        //a2={1,2,3,5,6,100};
        int max = a[0];
        int count=0;
        for (int i = 1; i < a.length; i++) {

            if (max < a[i]) {
                max = a[i];
                count=i;
            }
        }
        System.out.println("最大是" + max+",位置在："+(count+1) );
        System.out.println("在不在：");
        Scanner in=new Scanner(System.in);
        System.out.println("请输入要查找的数:");
        int k=in.nextInt();

        for (int i = 0; i < a.length; i++) {
           if(a[i]==k){
                System.out.println("在！");
                break;
            }
            if(i==a.length-1){
                System.out.println("不在");
            }
        }

//        boolean exist=false;
//        for (int i = 0; i < a.length; i++) {
//            if(a[i]==k){
//                exist=true;
//                break;
//            }
//        }
//        if(exist==false){
//            System.out.println(k+"不在数组中");
//        }else{
//            System.out.println(k+"在数组中");
//        }
    }
}
